<?php

namespace app\xcxapi\controller\v1;

use app\common\controller\XcxController;
use app\xcxapi\service\StudentService;

class Student extends XcxController
{
    /**
     * 学员列表
     * User: wufeng
     * Date: 2020/02/20.
     */
    public function studentLists()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new StudentService($this->type))->studentLists($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 学员详情
     * User: wufeng
     * Date: 2020/02/20.
     */
    public function studentDetail()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new StudentService($this->type))->studentDetail($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 订单记录
     * User: wufeng
     * Date: 2020/02/20.
     */
    public function orderRecord()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new StudentService($this->type))->orderRecord($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }

    /**
     * 就读记录
     * User: wufeng
     * Date: 2020/02/20.
     */
    public function attendSchoolRecord()
    {
        if ($this->request->isPost()) {
            $params = $this->request->param();
            $list = (new StudentService($this->type))->attendSchoolRecord($params);
            if (1 !== $list['code']) {
                $this->fail($list);
            }
            $this->win($list);
        }
        $this->fail('ILLEGAL_REQUEST');
    }
}
